package com.bosssoft.trainee.rbac.dao;

import com.bosssoft.trainee.rbac.entity.dto.UserDTO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface UserDao {
    /**
     * 用用户名选择User
     *
     * @param username username
     * @return Result<Users>
     */
    UserDTO selectUserByName(String username);
    /**
     * 用用户名删除用户
     *
     * @param username username
     * @return Result<>
     */
    int deleteUser(String username);
    /**
     * 添加user,并设置权限
     *
     * @param userDTO user
     * @return Result<>
     */
    int insertUser(UserDTO userDTO);
    /**
     * 修改权限
     *
     * @param userDTO user
     * @return Result<>
     */
    int updateUserRole(UserDTO userDTO);
    /**
     * 修改密码
     *
     * @param userDTO user
     * @return Result<>
     */
    int updateUserPwd(UserDTO userDTO);
    /**
     * 查询所有用户
     *
     * @return Result<List<UserDTO>>
     */
    List<UserDTO> getAllUser();
    /**
     * 查询某ID用户
     *
     * @param userId userId
     * @return Result<UserDTO>
     */
    UserDTO getUserById(Integer userId);
    /**
     * 查询某ID用户是否为管理员
     *
     * @param userId userId
     * @return Result<UserDTO>
     */
    UserDTO getUserIsAdmin(Integer userId);

}
